<?php
// 本类由系统自动生成，仅供测试用途
class UserAction extends CommonAction {
	public function _initialize(){
		parent::_initialize();
		$Info_db = M('Info');
		//热门观点
		$this->hotart = $Info_db -> where(array('status' => 1, 'type' => 'art', 'site_id'=> __SITEID__)) ->order('click desc')->limit('0,10') -> select();
		//用户分组
		$this->Member_group = M('Member_group') -> where(array('site_id' => __SITEID__))->select();
		$this->id = $this->_get('id');
		
		$id = $this->_get('id');
			$Member_db = M('Member');
			$member = $Member_db -> where(array('id' => $id)) -> find();
			$this -> assign($member);
			$authentication_DB = M('Authentication');
			$authentication = $authentication_DB -> where(array('member_id' => $id))->find();
			$this->assign('authentication',$authentication);
			//观点
			$this->daodb = D('Info');
		    $this->initView();
			
		    $this->daodb->_list($this->view, array('status' => 1,'type' => 'art','site_id' => __SITEID__),'id desc');
			
			//热门观点
			$this->hotInfo = $this->daodb->where(array('status' => 1,'type' => 'art','site_id' => __SITEID__))->order('click desc')->limit('0,10')->select();
	}
    public function index(){
		header("content-type:text/html; charset=utf-8");
		$memberDb = D('Member');
		$this->initView();
		$map = array();
		$map['n.site_id'] = __SITEID__;
		if($this->_get('group_id')){
			$map['n.group_id'] = $this->_get('group_id');
			$this->group_id = $map['n.group_id'];
		}
		$memberDb -> _list($this->view, $map, 'id desc', 2);
		$this->display();
    }
	public function usershow(){
		if($this->_get('id')){
			
			$this->display();
		 }
	}
	
	//答案列表
	public function answer(){
		$id = $this->_get('id');
		$andb=D('Info_ev');
		$map['ie.member_id'] = $id;
		$this->initView();
		$andb->_list($this->view, $map,'ie.id desc',5);
		$this->display();
	}
	
	public function readinfo(){
		$id=$this->_get('info_id');
		$infodb=D('Info');
		$info = $infodb->where(array('id' => $id))->find();
		$this->assign($info);
		$infodb -> update_click($id);
		$this->pagenav[1]['title'] = $info['title'];
		$this->display();
	}
}